@(paymentList: List[Payment])(implicit lang: Lang)
@import java.util._
@main("The Cult Cinema Inc. Past Transaction"){

<section style="padding-top:60px">
				<div class="row">
					<div class="span12">
						<ul class="breadcrumb">
							<li><a href="@routes.Application.index(lang.code)">@Messages("home")(lang)</a> <span class="divider">/</span></li>
		        			<li class="active">@Messages("member.pastTransactions")(lang)</li>
		        		</ul>
					</div>
				</div>
				<div class="row">

					<div class="span3">
						@sideBar(lang)
					</div>

					<div class="span9">
						<div class="well">
							<h3>@Messages("transaction.list")(lang)</h3>
							<table class="table table-bordered table-striped table-hover">
								<thead>
									<tr>
										<th>@Messages("transaction.time")(lang)</th>
										<th>@Messages("transaction.movie")(lang)</th>
										<th>@Messages("transaction.showtime")(lang)</th>
										<th>@Messages("transaction.house")(lang)</th>
										<th>@Messages("transaction.seat")(lang)</th>
										<th>@Messages("transaction.price")(lang)</th>
										<th>@Messages("transaction.refund")(lang)</th>
									</tr>
								</thead>
								<tbody>
									@paymentList.map { payment =>
										<tr>
											<td>@payment.paid_time.format("dd/MM/yyyy hh:mm aaa")</td>
											<td>@payment.session.movie.infos.get(0).name</td>
											<td>@payment.session.showtime.format("dd/MM/yyyy hh:mm aaa")</td>
											<td>@payment.session.house.id</td>
											<td>@payment.seat_no</td>
											<td>@if(payment.status==4){
													@Messages("transaction.loyaltyPurcase")(lang)
												} else {
												$@payment.session.price
												} </td>

											<td>
												@if(payment.status==0) {
													@{
														var c = Calendar.getInstance();
														c.setTime(payment.session.showtime);
														c.add(Calendar.HOUR, -3);
														var timeNow = new Date();
														var bRefundPeriod = timeNow.before(c.getTime());
														var requestRefundRoute = routes.Member.requestRefund(payment.id,lang.code).toString();
														var msg = Messages("transaction.refund.warnMsg")(lang);
														var title = Messages("transaction.refund.warning")(lang);
														var textOK = Messages("transaction.refund.ok")(lang);
														var textCancel = Messages("transaction.refund.cancel")(lang);
														var action = "return confirm('" +
															msg + "' , '" +
															title + "' , '" +
															textOK + "' , '" +
															textCancel + "' , '" +
															requestRefundRoute +
															"')"

														if(bRefundPeriod) {
															<a href={requestRefundRoute} onClick={action} class="btn btn-block btn-small btn-warning"><i class="icon-money"></i>  {Messages("transaction.refund.request")(lang)}</a>
														} else {
															<a class="btn btn-block btn-small btn-warning disabled"><i class="icon-money"></i>  {Messages("transaction.refund.request")(lang)}</a>
														}
													}

												}

												@if(payment.status==4){
													<a class="btn btn-block btn-small btn-warning disabled"><i class="icon-money"></i>  @Messages("transaction.refund.request")(lang)</a>
												}

												@if(payment.status==1){
												<a class="btn btn-block btn-small btn-warning disabled"><i class="icon-time"></i>  @Messages("transaction.refund.requested")(lang)</a>
												}

												@if(payment.status==3){
												<a class="btn btn-block btn-small btn-warning disabled"><i class="icon-ban-circle"></i>  @Messages("transaction.refund.rejected")(lang)</a>
												}


											</td>
										</tr>
									}
								</tbody>
							  </table>

						</div>
					</div>
				</div>
  			</section>

}(lang)